package com.mcy.springbatch.writer;

import org.springframework.batch.item.database.JpaItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;

/**
 * 利用JpaItemWriter把数据写到数据库
 *
 */
@Component
public class SysUserJpaItemWriter<SysUser> extends JpaItemWriter {

    @Autowired
    EntityManagerFactory entityManagerFactory;

    @PostConstruct
    public void init(){
        setEntityManagerFactory(entityManagerFactory);
    }

}
